<script>
import iconGongreguanxian from './images/icon-供热管线.svg'
import iconGongrefanwei from './images/icon-供热范围.svg'
import iconGongreqiye from './images/icon-供热企业.svg'
import iconHuanrezhan from './images/icon-换热站.svg'
import iconJianxiujing from './images/icon-检修井.svg'
import iconReyuan from './images/icon-热源.svg'
import iconFamen from './images/icon-阀门.svg'
import MAIN_STORE from '@/store/store.js'
export default {
  /**
   * 图例展示
   *
   */
  name: "global-legend",
  components: {
  },
  data() {
    return {
      legendList: [
        {
          name: '供热区划',
          icon: iconGongreqiye
        },
        {
          name: '热源',
          icon: iconReyuan
        },
        {
          name: '供热管线',
          icon: iconGongreguanxian
        },
        {
          name: '换热站',
          icon: iconHuanrezhan
        },
        {
          name: '供热范围',
          icon: iconGongrefanwei
        },
        {
          name: '检修井',
          icon: iconJianxiujing
        },
        {
          name: '阀门',
          icon: iconFamen
        }
      ],
      iconGongreguanxian,
      iconGongrefanwei,
      iconHuanrezhan,
      iconJianxiujing,
      iconFamen,
      showLegend: true
    }
  },
  computed: {
    slideMode() {
      return this.$store.state.slideMode
    }
  },
  watch: {
  },
  mounted() {
    this.$MITT_BUS.on('send-legend-visi', ({ tag }) => {
      this.showLegend = tag
    })
  },
  beforeUnmount() {
  },
  methods: {
  },
};
</script>

<template>
  <div class="global-legend" :class="[
    showLegend? '': 'hide',
    slideMode? 'stick-side': ''
  ]">
    <div class="header font-YouSheBiaoTiHei">
      <span>图例</span>
    </div>
    <div class="main-body">
      <div class="inner" v-for="(item, index) in legendList" :key="index">
        <div class="icon-area">
          <img :src="item.icon" />
        </div>
        <div class="title">
          <span>{{ item.name }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<style lang="less" scoped>
.global-legend {
  position: fixed;
  width: 25rem;
  bottom: 10rem;
  right: 52rem;
  pointer-events: all;
  background-image: linear-gradient(90deg, rgba(16, 49, 102, 0.9) 13%, rgba(8, 35, 78, 0.8) 91%);
  border-right: 1px solid #22b5ff;
  border-bottom: 1px solid rgba(34, 180, 255, .5);
  transition: all .3s;
  &.stick-side {
    right: 7.5rem;
  }
  &.hide {
    display: none;
  }
  &>.header {
    height: 3rem;
    font-size: 2rem;
    color: #fff;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    letter-spacing: 1rem;
    background-image: linear-gradient(to right, #2d7bd5, rgba(4, 30, 60, .2));
  }
  &>.main-body {
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    &>.inner {
      width: 50%;
      margin: 0.5rem 0;
      display: flex;
      align-items: center;
      &>.icon-area {
        width: 4rem;
        &>img {
          width: 3rem;
          height: 3rem;
        }
      }
      &>.title {
        font-size: 1.4rem;
        color: #fff;
        font-family: "ALIBABAPUHUI-REGU";
      }
    }
  }
}
</style>